<?php defined('SYSPATH') or die('No direct script access.');
/**
 * Created by PhpStorm.
 * Author: ls
 * Time: 2020/10/23 14:19
 * Desc: 系统应用公共方法
 */
class Controller_Pc_Api_V2_Product extends Controller_Pc_Api_v2_Base
{
    // 获取属性列表
    public function action_get_attr_list()
    {
        $typeid = intval($this->request_data->typeid);
        if(!$typeid)
        {
            $result = array(
                'status'=> false,
                'msg'   => '提交参数有误'
            );
            $this->send_datagrams($this->client_info['id'], $result, $this->client_info['secret_key']);
        }
        $pid    = intval($this->request_data->pid);
        $list   = Model_Attrlist::getAttr($typeid,$pid);
        foreach ($list as &$v)
        {
            $v = Model_Api_V2_Common::res_data("attrname,id,litpic,pid,description",$v);
            $v['litpic'] = Model_Api_V2_System::uniapp_img($v['litpic']);
        }
        $result = array(
            'status'=> true,
            'msg'   => '获取成功',
            'data'  => array(
                'list'=> $list
            )
        );
        $this->send_datagrams($this->client_info['id'], $result, $this->client_info['secret_key']);
    }
}